//
//  BKZhuSuView.m
//  baokaodaxue
//
//  Created by dangyangyang on 15/6/1.
//  Copyright (c) 2015年 宏图教育. All rights reserved.
//

#import "BKZhuSuView.h"
#import "BKZhaoShengTableViewCell.h"


static NSString *zhusu = @"zhusu";
@implementation BKZhuSuView

- (void)awakeFromNib{
    
    [_tableView registerNib:[UINib nibWithNibName:NSStringFromClass([BKZhaoShengTableViewCell class]) bundle:nil] forCellReuseIdentifier:zhusu];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.separatorColor= [UIColor clearColor];
    _tableView.layer.cornerRadius = 5;
    _tableView.layer.borderColor = [[UIColor colorWithRed:0.529 green:0.867 blue:0.941 alpha:1.000]CGColor];
    _tableView.layer.borderWidth = .5;
    
}

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    BKZhaoShengTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:zhusu];
    if (indexPath.row%2==0) {
        cell.backgroundColor = [UIColor clearColor];
    }else{
        cell.backgroundColor = [UIColor colorWithRed:0.914 green:0.965 blue:0.980 alpha:1.000];
    }
    
    if (indexPath.row ==0 ) {
        cell.zhuanye.text = @"宿舍人数";
        cell.jihua.text = @"收费";
    }else{
    
        cell.zhuanye.text = _dataArray[indexPath.row-1][@"renshu"];
        cell.jihua.text = _dataArray[indexPath.row-1][@"shoufei"];
    }
    return cell;
    
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return [_dataArray count];;
}



-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 34;
}


- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    
    return [UIView new];
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    
    return 1;
}


@end
